export function getYear() {
  return new Date().getFullYear();
}
export function getMonth() {
  let month = new Date().getMonth() + 1
  return month > 9 ? month : '0' + month
}
export function getDate() {
  let date = new Date().getDate()
  return date > 9 ? date : '0' + date
}
export function getHours() {
  let hours = new Date().getHours()
  return hours > 9 ? hours : '0' + hours
}
export function getMinutes() {
  let minute = new Date().getMinutes()
  return minute > 9 ? minute : '0' + minute
}
export function dateToFormat(originDate) {
  if (!originDate) return
  const dt = new Date(originDate);
  const y = dt.getFullYear();
  const m = (dt.getMonth() + 1 + "").padStart(2, "0");
  const d = (dt.getDate() + "").padStart(2, "0");

  const hh = (dt.getHours() + "").padStart(2, "0");
  const mm = (dt.getMinutes() + "").padStart(2, "0");
  const ss = (dt.getSeconds() + "").padStart(2, "0");

  return `${y}-${m}-${d} ${hh}:${mm}:${ss}`;
}
export function dateToFormatYMD(originDate) {
  if (!originDate) return
  const dt = new Date(originDate)
  const y = dt.getFullYear()
  const m = (dt.getMonth() + 1 + '').padStart(2, '0')
  const d = (dt.getDate() + '').padStart(2, '0')
  return `${y}-${m}-${d}`
}
export function dateToFormat2(originDate) {
  if (!originDate) return
  const dt = new Date(originDate);
  const y = dt.getFullYear();
  const m = (dt.getMonth() + 1 + "").padStart(2, "0");
  const d = (dt.getDate() + "").padStart(2, "0");

  const hh = (dt.getHours() + "").padStart(2, "0");
  const mm = (dt.getMinutes() + "").padStart(2, "0");
  const ss = (dt.getSeconds() + "").padStart(2, "0");

  return `${y}${m}${d}${hh}${mm}${ss}`;
}
export function dateToFormat3(originDate) {
  if (!originDate) return
  const dt = new Date(originDate);
  const y = dt.getFullYear();
  const m = (dt.getMonth() + 1 + "").padStart(2, "0");
  const d = (dt.getDate() + "").padStart(2, "0");
  return `${y}${m}${d}`;
}
